package com.cosina.game.crystallight.model.crystal;

import com.cosina.game.crystallight.data.CrystalInfo;
import com.cosina.game.crystallight.engine.BattleEngine;



public class Desk{
	public final Box[] boxes;
	public final CrystalSeed[] seeds;;
	public final Cuvette cuvette;
	public Desk(){
		this.boxes = new Box[6];
		this.seeds = new CrystalSeed[6];
		for(int i=0; i<6; i++){
			boxes[i] = new Box(this,i);
			seeds[i] = new CrystalSeed(i);
		}
		this.cuvette = new Cuvette();
	}
	
	public boolean canFeeds(){
		return BattleEngine.manaFlask.getCurrent() >= CrystalInfo.LOWEST_MANA_REQUIRED_FOR_CRYSTAL;
	}
	
	public void fillSeeds(){
		if(canFeeds()){
			for(int i=0; i<6; i++) {
				Box box = boxes[i];
				if(null == box.crystal){
					box.seed = seeds[i];
				}
			}
		}
	}

	public void unfeed() {
		for(int i=0; i<6; i++) {
			Box box = boxes[i];
			if(box.seed != null){
				box.seed = null;
			}
		}
	}
}
